package com.tgpms.vforms.controller;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.tgpms.common.Result;
import com.tgpms.exception.ExceptionExplain;
import com.tgpms.vforms.service.EngineeringService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;

@Api(value = "EngineeringController", tags = "D1021 工程相关接口")
@RestController
@RequestMapping(value = "/ev/vform/Engineering")
public class EngineeringController {

	@Autowired
	private EngineeringService engineeringService;
	
	@ApiOperation(value = "查询工程项目信息树形接口", notes = "查询工程项目信息树形接口", httpMethod = "POST")
	@ApiImplicitParams({
		@ApiImplicitParam(name = "dataowner",value = "数据拥有者",required = false),
		@ApiImplicitParam(name = "entityItem",value = "人员编码",required = false)
	})
	@PostMapping(value = "/selEngineeringTreeList")
	public Result<List<Map<String, Object>>> selEngineeringTreeList(
    		@RequestParam(value = "dataowner", required = false) String dataowner,
    		@RequestParam(value = "entityItem", required = false) String entityItem) {
        List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
        try {
        	list = engineeringService.selEngineeringTreeList(dataowner,entityItem);
        	return Result.OK(ExceptionExplain.SUCCESS_BY_INFOS.getExplain(), list);
        } catch (Exception e) {
            e.printStackTrace();
            return Result.ERROR(ExceptionExplain.ERROR_BY_INFOS.getExplain());
        }
	}
}
